// 關於管制監控的所有接口
import { useAxios } from '@/hooks/web/useAxios'
const request = useAxios()

/**
 * 登录日志查询
 * @param data 搜索条件
 */
export const getLoginLog = (data) => {
  return request.post({
    url: 'log/loginLog/query',
    data
  })
}

/**
 *@author ly
 *@description: 獲取系統操作日志
 *@Date: 2022-06-23 15:11:56
 **/
export const getSystemLog = (data) => {
  return request.post({
    url: 'log/systemLog/query',
    data
  })
}

/**
 * @description 获以线用户
 * @author Elwin ZHANG
 * @date 2023-04-14 11:39
 */
export const getOnlineUsers = () => {
  return request.get({
    url: 'user/user/getOnlineUsers'
  })
}

/**
 * 强制下线
 * @param userId 用户ID
 */
export const forceOffline = (userId) => {
  return request.postXww({
    url: 'user/user/forcedOffline',
    data: { userId: userId }
  })
}

/**
 * IP策略查询
 * @param data 搜索条件
 */
export const getIpStrategy = (data) => {
  return request.post({
    url: 'user/ipStrategy/query',
    data
  })
}

/**
 * @description  删除 IP策略
 */
export const delIpStrategy = (id) => {
  return request.postXww({
    url: 'user/ipStrategy/del',
    params: { ids: id }
  })
}

/**
 * @description 保存 IP策略
 */
export const saveIpStrategy = (data) => {
  return request.post({
    url: 'user/ipStrategy/save',
    data: data
  })
}
